package com.dundun.pattern.builder;

public class BuilderMain {
    public static void main(String[] args) {
        if(args.length != 1) {
            usage();
        } else if("plain".equals(args[0])) {
            Builder builder = new TextBuilder();
            Director director = new Director(builder);
            director.construct();
            System.out.println(builder.getResult());
        } else if("html".equals(args[0])) {
            Builder builder = new HTMLBuilder();
            Director director = new Director(builder);
            director.construct();
            System.out.println(builder.getResult() + "文件完成。");
        }
    }

    private static void usage() {
        System.out.println("Usage: java Main plain");
        System.out.println("Usage: java Main html");
        System.exit(0);
    }
}
